#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

struct Stu
{
	char name[20];
	int age;

};

int sort_by_name(const void* p1, const void* p2)
{
	return strcmp(((struct Stu*)p1)->name, ((struct Stu*)p2)->name);
}

int sort_by_age(const void* p1, const void* p2)
{
	return ((struct Stu*)p1)->age - ((struct Stu*)p2)->age;
}

int cmp_by_char(const void* p1, const void* p2)
{
	return strcmp((char*)p1, (char*)p2);
}
int main()
{
	//struct Stu s[3] = { {"zhangsan", 20},{ "lisi", 30 },{ "wangwu", 18 } };
	//qsort(s,3,24,sort_by_name);
	//qsort(s, 3, 24, sort_by_age);

	char arr[10] = { 'c','d','a','b'};
	qsort(arr,10,1,cmp_by_char);
	return 0;
}